import request from '@/utils/request'

// 获取健康记录列表
export function getHealthRecordsList(params) {
  return request({
    url: '/api/health-records/list',
    method: 'get',
    params
  })
}

// 添加健康记录
export function addHealthRecord(data) {
  return request({
    url: '/api/health-records',
    method: 'post',
    data
  })
}

// 获取健康记录
export function getHealthRecords(params) {
  return request({
    url: '/api/health-records',
    method: 'get',
    params
  })
}

// 删除健康记录
export function deleteHealthRecord(id) {
  return request({
    url: `/api/health-records/${id}`,
    method: 'delete'
  })
}

// 获取健康分析数据
export function getHealthAnalysis() {
  return request({
    url: '/api/health-records/analysis',
    method: 'get'
  })
}

// 获取健康报告
export function getHealthReport(params) {
  return request({
    url: '/api/health-records/report',
    method: 'get',
    params: {
      startDate: params.startDate,
      endDate: params.endDate
    }
  })
}

// 导出健康记录
export function exportHealthReport(params) {
  return request({
    url: '/api/health-records/report/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// 获取最新健康记录
export function getLatestRecords() {
  return request({
    url: '/api/health-records/latest',
    method: 'get'
  })
}

// 导出健康记录
export function exportHealthRecords(params) {
  return request({
    url: '/api/health-records/export',
    method: 'get',
    params,
    responseType: 'blob'
  })
}


